#include "selection_sort.h"
#include "utils.h"
#include "benchmark.h"

void selectionSort(int *a, int n) {
	int i, j, min;
	for (i=0; i<=n-2; i++) {
		min = i;
		for (j=i+1; benchAddOperation(benchmark) && j<=n-1; j++) {
			if (a[j] < a[min])
				min = j;
		}
		swap(a, i, min);
	}
}